import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../components/home.vue'
import Index from '../components/index/index.vue'
import About from '../components/about/about.vue'
import About_Introduction from '../components/about/introduction.vue'
import About_Video from '../components/about/video.vue'
import About_Staff from '../components/about/staff.vue'
import News from '../components/news/news.vue'
import News_Company from '../components/news/company.vue'
import Case from '../components/case/case.vue'
import Case_List from '../components/case/case_list.vue'
import Product from '../components/product/product.vue'
import Product_List from '../components/product/product_list.vue'

import Personnel from '../components/personnel/personnel.vue'
import Personnel_List from '../components/personnel/personnel_list.vue'
import Contact from '../components/contact/contact.vue'
import Contact_List from '../components/contact/contact_list.vue'

Vue.use(VueRouter)

const routes = [{
	path: '/',
	name: 'Home',
	component: Home,
	redirect: '/index',
	children: [{
		path: '/index',
		component: Index
	}, {
		path: '/about',
		component: About,
		redirect:'/about/introduction',
		children:[{
			path: '/about/introduction',
			component: About_Introduction,
		},{
			path: '/about/video',
			component: About_Video,
		},{
			path: '/about/staff',
			component: About_Staff,
		}]
	}, {
		path: '/news',
		component: News,
		redirect:'/news/company/1',
		children:[{
			path: '/news/company/:id',
			component: News_Company,
		}]
	}, {
		path: '/case',
		component: Case,
		redirect:'/case/case_list/1',
		children:[{
			path: '/case/case_list/:id',
			component: Case_List,
		}]
	}, {
		path: '/product',
		component: Product,
		redirect:'/product/product_list/1',
		children:[{
			path: '/product/product_list/:id',
			component: Product_List,
		}]
	}, {
		path: '/personnel',
		component: Personnel,
		redirect:'/personnel/personnel_list',
		children:[{
			path: '/personnel/personnel_list',
			component: Personnel_List,
		}]
	}, {
		path: '/contact',
		component: Contact,
		redirect:'/contact/contact_list',
		children:[{
			path: '/contact/contact_list',
			component: Contact_List,
		}]
	}]
}, ]

const router = new VueRouter({
	routes
})

const originalPush = VueRouter.prototype.push
   VueRouter.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}

export default router
